<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="renderer" content="webkit"> 
	<meta content="always" name="referrer">
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<link rel="stylesheet" type="text/css" href="css/login.css" /> 
	<title>欢迎登录</title>
	<!--[if lt IE 9]>
			<script type="text/javascript">
				window.location.href = "tip.html"
			</script>
		<![endif]-->
	<script src="js/jquery.min.js" type="text/javascript" charset="utf-8"></script>
</head>
<body style="min-width: 1360px;">

<div class="log_head" style="padding-top: 30px;">
    <h1 class="h1"><a href="index.html" >WELCOME</a><span>欢迎注册</span></h1>
    <h1 class="h2">没有账号，请<a href="register.html">注册</a></h1>
</div>
	<div class="log1" style="background: url('img/denglubeijing.jpg')">
		<div class="log_bg1">
			<form id="loginFrom" name="loginFrom" method="post">
				<!-- 错误提示 -->
				<div class="log_hint"></div>
				<ul>
					<li><div class="seekBox"><input id="mobile" name="userAccount"  class="text" type="text" placeholder="请输入您的邮箱"  autocomplete="off"><i class="J_empty">×</i></div></li>
					<li class=""><div class="seekBox"><input name="password" id="loginpw" class="text mima" type="password" placeholder="请输入密码" customFun="fucLoginPw" autocomplete="off"><i class="J_empty">×</i></div></li>
					<li class="lb_btn"><a class="J_log_hint" id="loginNow">立即登录</a></li>
					<li class="lb_forget">
                        <a href="register.html" class="registerno">免费注册</a><a href="findword.html">忘记密码?</a>
                    </li>
				</ul>
			</form>
		</div>
	</div>
	<div class="footer" style="margin-top: 10px;">
		<p>Copyright &copy;2012-2017,youaizhilv.com.All Rights Reserved 友爱之旅
			版权所有 ICP证：京88888888 号</p>
	</div>
	<div id="qq">
		
	</div>
</body>
<script src="js/jquery.min.js"></script>
<script src="lib/layui/layui.js" type="text/javascript" charset="utf-8"></script>
<script src="js/ajaxSet.js" type="text/javascript" charset="utf-8"></script>
<script src="js/jquery.md5.js" type="text/javascript" charset="utf-8"></script>
</html>
<script>
 layui.use(['form', 'layedit', 'laydate','element'], function() {
    var layer = layui.layer;
    $("#qq").load("lib/qq.html");$("#footer").load("lib/footer.html");
	$("#loginFrom ul li input").focus(function(){
		$(this).parent("div").parent("li").addClass("focus");
	}).blur(function(){
		$(this).parent("div").parent("li").removeClass("focus");
	});
	
	var layer = layui.layer;
	
	$("#loginNow").on("click",function (){
		var email = $("#mobile").val(),
			password = $("#loginpw").val();
		jQuery.support.cors = true;	
		$.ajax({
			type:"post",
			url:"http://52lvu.cn:8080/api/login/login",
			data :{
				email : email ,
				password : password
			},success : function (result){

				if (result.resultCode == 109) {
					layer.msg("您的邮箱还没有注册",{icon:2,time:3000});
				}else if (result.resultCode == 200){
					
					var userInfo = result.data
					
					userInfo.loginTime = new Date().getTime();
					
					localStorage.token = JSON.stringify(userInfo);

					layer.msg("登录成功，即将为您跳转到首页",{icon:6,time:3000});
					setTimeout(function(){
					    window.location.href = "index.html";
					},2000)
				}else if (result.resultCode == 105){
					layer.msg("您的账号正在审核中，暂时无法登陆",{icon:2,time:3000});
				}else if (result.resultCode == 102){
					layer.msg("您的密码错误!",{icon:2,time:3000});
				}else{
					layer.msg("请求错误，请稍后重试!",{icon:2,time:3000});
				}
				
			}
			, error: function (a, b, c) {alert(c);}
//			,error : function (e){

//				layer.msg("请求错误，请稍后重试",{icon:2,time:3000});
//			}
		});
	})
})
</script>